<script setup>
defineProps({
  product: {
    type: Object,
    required: true
  }
})

defineEmits(['product-click'])
</script>

<template>
  <div class="product-card" @click="$emit('product-click', product)">
    <div class="product-image">
      <img :src="product.image" :alt="product.name">
    </div>
    <div class="product-info">
      <h3 class="product-name" v-text="product.name"></h3>
      <p class="product-description" v-text="product.description"></p>
      <div class="product-price">¥<span v-text="product.price"></span></div>
      <button class="product-button">查看详情</button>
    </div>
  </div>
</template>

<style scoped>
.product-card {
  background: white;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  cursor: pointer;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.product-card:hover {
  transform: translateY(-10px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  border-color: rgba(102, 126, 234, 0.3);
}

.product-image {
  height: 200px;
  overflow: hidden;
}

.product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.product-card:hover .product-image img {
  transform: scale(1.05);
}

.product-info {
  padding: 1.8rem;
  text-align: center;
}

.product-name {
  font-size: 1.5rem;
  margin-bottom: 0.8rem;
  color: #333;
  font-weight: 700;
}

.product-description {
  color: #666;
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 1.2rem;
  min-height: 60px;
}

.product-price {
  font-size: 1.8rem;
  font-weight: 800;
  color: #667eea;
  margin-bottom: 1.5rem;
}

.product-button {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 25px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.product-button:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

@media (max-width: 768px) {
  .product-card {
    border-radius: 15px;
  }
  
  .product-image {
    height: 150px;
  }
  
  .product-info {
    padding: 1.5rem;
  }
  
  .product-name {
    font-size: 1.3rem;
  }
  
  .product-price {
    font-size: 1.5rem;
  }
}
</style>